<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5shiv.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<title>添加用户 - H-ui.admin v3.0</title>
<meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container" style="width:80%">
	<form action="/checkedit" method="post" class="form form-horizontal" id="form-check-edit">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">申请人：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width:30%">
				<input type="text" class="input-text" value="${Session["oauser"].userUsername}" readonly="readonly"  id="userusername" name="userusername">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">部门：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width:30%">
				<input type="text" class="input-text" value="${Session["oauser"].oaDept.deptName}" readonly="readonly" name="deptname" id="deptname">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">申请日期：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width:30%">
				<input type="text" class="input-text" value="${.now?string('yyyy-MM-dd')}" readonly="readonly"  id="checktime" name="checkTime">
			</div>
		</div>
		<div class="row cl" >
			<label class="form-label col-xs-4 col-sm-3">考勤类别：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width:30%">
			<input type="text" readonly="readonly" class="input-text" id="select" value="${data.oaChecktypes.checktypesName}" name="select">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">日期[24小时制]</label>
			<div class="formControls col-xs-8 col-sm-9" >
				自：<input type="text" readonly="readonly"  class="input-text" id="checkBegin" value="${data.checkBegin?string('yyyy-MM-dd HH:mm:ss')}" name="checkBegin"  style="width:160px;"></input>
				至：<input type="text" readonly="readonly" class="input-text" value="${data.checkEnd?string('yyyy-MM-dd HH:mm:ss')}" id="checkEnd" name="checkEnd"  style="width:160px;">&nbsp;&nbsp;
				共计：<input type="text" readonly="readonly" class="input-text" style="width:160px" placeholder="00天00小时00分" id="checkDate"  value="${data.checkDate}" name="checkDate">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">申请主题：</label>
			<div class="formControls col-xs-8 col-sm-9" >
				<input readonly="readonly" type="text" class="input-text" placeholder="" id="checktitle" name="checkTitle"  value="${data.checkTitle}">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">申请事由：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea readonly="readonly" cols="" rows="" id="checkcontext" name="checkContext" class="textarea"   placeholder="可选...填写可便于理解" onKeyUp="$.Huitextarealength(this,100)">${data.checkContext}</textarea>
			</div>
		</div>
		<div class="row cl" >
		<br/>
			<label class="form-label col-xs-4 col-sm-3">审批意见：</label>
			<div class="formControls col-xs-8 col-sm-9" >
			<select class="select" size="1" id="submitId" name="submitId" >
					<option value="" selected>审批意见：</option>
					<option value="2">已完成</option>
					<option value="3">未通过</option>
				</select>
			</div>
		</div>
		<div class="row cl" >
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="button" id="checkreply" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				<input class="btn btn-default radius" type="button" id="cancelBtn" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本  id="checkbeginday" name="checkbeginday" --> 
<!--日历插件-->
<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	
	//审批
	var checkreply = function(){                                                                                                
		$.ajax({
			   type: "GET",
			   dataType: "json",
			   url: "/checkreply",
			   data: {
					"checkId":${data.checkId},						
					"submitId": $("#submitId").val()
			   },
			   success: function(msg){ 
					 $('#cancelBtn').click(); 	
			    }
		});
	}   
	
	
	$('#checkreply').on('click', function(){
		checkreply();
	});
	
	 $('#cancelBtn').on('click', function(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.getUserPageList();
		parent.layer.close(index);
	}); 
	
	//日期判断，当开始日期选择了，才能选择结束日期，两个都选完后，开始日期只要变更，结束日期就清空重新写，避免日期混乱问题
	$(function(){
		$('input[name="checkbeginday"]').focus(function(){
			$('input[name="checkendday"]').val('');
			var key=$('input[name="checkbeginday"]').val();
			if(key==undefined||key==""||key==null){
				$('input[name="checkendday"]').attr("disabled", true);
			}else{
				$('input[name="checkendday"]').attr("disabled", false);
			}
		})
	});
	
	//做开始日期字符串连接，放在隐藏域checkbegin
	$(function(){
		$("#datemin,#checkbeginmin,#checkbeginhour").blur(function(){
			var bday=$('input[name="checkbeginday"]').val();
			var bhour=$("#checkbeginhour").val();
			var bmin=$("#checkbeginmin").val();
			var checkbegin=bday+" "+bhour+":"+bmin+":"+"00";
			var time=bhour+":"+bmin;
			if(bday==""){
				$("#checkbeginhour").val('');//清空内容
   				$("#checkbeginmin").val('');//清空内容
   				$("#checkBegin").attr("value",'');//清空内容 
                return;
			}else{
				//时的正则表达式
				var reghour=/^(2[0-3]|[0-1]?\d)$/;
				//分的正则表达式
				var regmin=/^[0-5]{0,1}[0-9]$/;
				if(reghour.test(bhour)==false){ 
					$("#checkbeginhour").val('');//清空小时
   					$("#checkBegin").attr("value",'');//清空内容 
                	return;
	        	}else if(regmin.test(bmin)==false){
	        		$("#checkbeginmin").val('');//清空分钟
   					$("#checkBegin").attr("value",'');//清空内容
                	return;
	        	}else if(reghour.test(bhour)==true&&regmin.test(bmin)==true){
	        		$("#checkBegin").attr("value",checkbegin);//将时间赋值给了隐藏域
					return;
	        	}
	        }
		})
	});
	
	//做结束日期字符串连接，放在隐藏域
	$(function(){
		$("datemax,#checkendmin,#checkendhour").blur(function(){
			var eday=$('input[name="checkendday"]').val();//结束天
			var ehour=$("#checkendhour").val();//结束时
			var emin=$("#checkendmin").val();//结束分
			var checkend=eday+" "+ehour+":"+emin+":"+"00";
			var time=ehour+":"+emin;
			if(eday==""){
				$("#checkendhour").val('');//清空内容
   				$("#checkendmin").val('');//清空内容
   				$("#checkEnd").attr("value",'');//清空内容 
                return;
			}
			/*else{
				//时间的正则表达式 hh:mm基础的
				var reg=/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/;
				if(reg.test(time)==true){
					$("#checkEnd").attr("value",checkend);//将时间赋值给了隐藏域
					return;
	            }*/
	        else{
	       	 	
				//时的正则表达式
				var reghour=/^(2[0-3]|[0-1]?\d)$/;
				//分的正则表达式
				var regmin=/^[0-5]{0,1}[0-9]$/;
				if(reghour.test(ehour)==false){ 
					$("#checkendhour").val('');//清空小时
   					$("#checkEnd").attr("value",'');//清空内容 
                	return;
	        	}else if(regmin.test(emin)==false){
	        		$("#checkendmin").val('');//清空分钟
   					$("#checkEnd").attr("value",'');//清空内容
                	return;
	        	}else if(reghour.test(ehour)==true&&regmin.test(emin)==true){		
	        		$("#checkEnd").attr("value",checkend);//将时间赋值给了隐藏域
	        		var checkdate=GetDateDiff();
	        		$("#checkDate").attr("value",checkdate);
					return;
	        	}
	        }
		})
	});
	
	function GetDateDiff() {
		//获取日期
	    var begin = document.getElementById('checkBegin').value;
        var end =  document.getElementById('checkEnd').value;
	    var sTime = new Date(begin);      //开始时间
	    var eTime = new Date(end);  //结束时间
        var date3=eTime-sTime;  //时间差的毫秒数
		//计算出相差天数
		var days=Math.floor(date3/(24*3600*1000)) ;
		//计算出小时数
		var leave1=date3%(24*3600*1000);    //计算天数后剩余的毫秒数
		var hours=Math.floor(leave1/(3600*1000));
		//计算相差分钟数
		var leave2=leave1%(3600*1000);        //计算小时数后剩余的毫秒数
		var minutes=Math.floor(leave2/(60*1000));
		//计算相差秒数
		var leave3=leave2%(60*1000);      //计算分钟数后剩余的毫秒数
		var seconds=Math.round(leave3/1000);
		var checkdate=(days+"天 "+hours+"小时 "+minutes+" 分钟");
		return checkdate;
		}
	
	
	
/*做共计日期字符串连接，放在隐藏域
	$(function(){
		$("#checkdatehour,#checkdateday").blur(function(){
			//0-正整数时的正则表达式
			var regday=/^(0|[1-9]\d*)$/;
			//0-23时的正则表达式
			var reghour=/^(2[0-3]|[0-1]?\d)$/;
			//日和小时
			var dday=$('#checkdateday').val();
			var dhour=$("#checkdatehour").val();
			var checkdate=dday+"天"+dhour+"小时";		
				if(regday.test(dday)==false){ 
					$("#checkdateday").val('');//清空天数
   					$("#checkDate").attr("value",'');//清空内容 
                	return;
	        	}else if(reghour.test(dhour)==false){
	        		$("#checkdatehour").val('');//清空小时
   					$("#checkDate").attr("value",'');//清空内容 
                	return;
	        	}else if(regday.test(dday)==true&&reghour.test(dhour)==true){
	        		$("#checkDate").attr("value",checkdate);//将天数赋值给了隐藏域
					return;
	        	}
		})
	});
*/
	
	//检验表单是否填值，对应的是name的属性采用的是这个/oa/src/main/webapp/admin/lib/jquery.validation
	$("#form-check-edit").validate({
		rules:{
			userusername:{
				required:true,
				minlength:2,
				maxlength:16
			},
			deptname:{
				required:true,
			},
			checkTime:{
				required:true,
			},
			oaChecktypes:{
				required:true,
			},
			checkbeginday:{
				required:true,
			},
			checkbeginhour:{
				required:true,
			},
			checkbeginmin:{
				required:true,
			},
			checkendday:{
				required:true,
			},
			checkendhour:{
				required:true,
			},
			checkendmin:{
				required:true,
			},
			checkdateday:{
				required:true,
			},
			checkdatehour:{
				required:true,
			},
			submitId:{
				required:true,
			},
			checkBegin:{
				required:true,
			},
			checkEnd:{
				required:true,
			},
			checkDate:{
				required:true,
			},
			
			checkTitle:{
				required:true,
			},
			//isMobile是/oa/src/main/webapp/admin/lib/jquery.validation/1.14.0/validate-methods.js目录下的正则表达式验证
			mobile:{
				required:true,
				isMobile:true,
			},
			email:{
				required:true,
				email:true,
			},
			uploadfile:{
				required:true,
			},		
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit();
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}	
	});	
	
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>